﻿@using JPProject.Domain.Core.StringUtils
@model Jp.UI.SSO.Models.LogoutViewModel
@using Microsoft.AspNetCore.Mvc.Localization
@using Org.BouncyCastle.Crypto.Engines
@inject IViewLocalizer Localizer
@{
    Layout = "~/Views/Shared/_Layout.cshtml";
}
@section breadcrumb
    {
    <!-- Breadcrumb-->
    <ol class="breadcrumb">
        <li class="breadcrumb-item">@Localizer["Title-Home"]</li>
        <li class="breadcrumb-item">
            <a asp-action="Index" asp-controller="Home">User</a>
        </li>
        <li class="breadcrumb-item active">@Localizer["Body-Logout"]</li>
    </ol>
}
<div class="row justify-content-center">
    <div class="col-md-8">
        <div class="card-group">
            <div class="card p-4">
                <div class="card-body">
                    @if (!string.IsNullOrEmpty(Model.Client))
                    {
                        <p>@Localizer["Body-IdentityServer"].Value.Replace("{{client}}", Model.Client)</p>
                    }
                    else
                    {
                        <p>@Localizer["Body-IdentityServer"].Value.Replace("{{client}}", "JP Project")</p>
                    }
                    <form asp-action="Logout">
                        <input type="hidden" name="logoutId" value="@Model.LogoutId" />
                        <fieldset>
                            <div class="form-group">
                                <button class="btn btn-primary">@Localizer["Body-Yes"]</button>

                                @if (Model.PostLogoutRedirectUri.IsMissing())
                                {
                                    <a class="btn btn-primary" asp-action="Index" asp-controller="Home">@Localizer["Body-No"]</a>
                                }
                                else
                                {
                                    <a class="btn btn-secondary" href="@Model.PostLogoutRedirectUri">@Localizer["Body-No"]</a>
                                }
                            </div>
                        </fieldset>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>